/**
* 获取演示数据库 SQL 脚本
*/
function getExampleSql() {
if (typeof (getMySql) == "function") {
return getMySql();
}
return `
-- ----------------------------
-- 管理员管理
-- ----------------------------
DROP TABLE IF EXISTS es_auth_admin;
CREATE TABLE IF NOT EXISTS es_auth_admin (
id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
username VARCHAR(60) NOT NULL COMMENT '用户名',
nickname VARCHAR(60) NOT NULL DEFAULT '' COMMENT '昵称',
realname VARCHAR(60) NOT NULL DEFAULT '' COMMENT '姓名',
password VARCHAR(32) NOT NULL COMMENT '密码',
salt VARCHAR(10) NOT NULL DEFAULT '' COMMENT '密码盐',
avatar VARCHAR(200) NOT NULL DEFAULT '' COMMENT '头像',
email VARCHAR(100) NOT NULL DEFAULT '' COMMENT '电子邮箱',
mobile VARCHAR(11) NOT NULL DEFAULT '' COMMENT '手机号码',
gender TINYINT UNSIGNED NOT NULL DEFAULT 3 COMMENT '性别:1=男,2=女,3=未知',
login_count INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '登录次数',
login_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '登录时间',
login_ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT '登录IP',
register_ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT '注册IP',
status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用,3=待审核,4=审核驳回',
created_at INT UNSIGNED NOT NULL COMMENT '注册时间',
updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (id),
UNIQUE KEY uk_username (username),
KEY k_mobile (mobile)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员管理?module=权限';

-- ----------------------------
-- 角色管理
-- ----------------------------
DROP TABLE IF EXISTS es_auth_role;
CREATE TABLE IF NOT EXISTS es_auth_role (
id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
title VARCHAR(60) NOT NULL DEFAULT '' COMMENT '标题',
name VARCHAR(30) NOT NULL COMMENT '名称',
status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色管理?module=权限';

-- ----------------------------
-- 菜单管理
-- ----------------------------
DROP TABLE IF EXISTS es_auth_menu;
CREATE TABLE IF NOT EXISTS es_auth_menu (
id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
title VARCHAR(60) NOT NULL COMMENT '标题',
controller VARCHAR(60) NOT NULL DEFAULT '' COMMENT '控制器名称',
action VARCHAR(60) NOT NULL DEFAULT '' COMMENT '操作名称',
type TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '类型:1=分类,2=菜单,3=按钮',
icon VARCHAR(200) NOT NULL DEFAULT '' COMMENT '菜单图标',
sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (id),
KEY k_pid (pid),
KEY k_sort (sort)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单管理?module=权限';
`
}

// 业务SQL
function getMySql() {
return `

-- ++++++++++++++++++++ 会员模块 ++++++++++++++++++++

-- ----------------------------
-- 会员管理
-- ----------------------------
DROP TABLE IF EXISTS es_member;
CREATE TABLE IF NOT EXISTS es_member (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_name VARCHAR(60) NOT NULL COMMENT '会员账号',
  nickname VARCHAR(60) NOT NULL DEFAULT '' COMMENT '会员昵称',
  realname VARCHAR(60) NOT NULL DEFAULT  '' COMMENT '真实姓名',
  password VARCHAR(32) NOT NULL COMMENT '会员密码',
  salt VARCHAR(10) NOT NULL DEFAULT '' COMMENT '密码盐',
  trade_pwd VARCHAR(32) NOT NULL DEFAULT '' COMMENT '交易密码',
  operate_password VARCHAR(32) NOT NULL DEFAULT '' COMMENT '操作密码',
  birthday DATE COMMENT '生日',
  age INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '年龄',
  gender TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '性别:1=男,2=女,3=未知',
  idcard_no VARCHAR(18) NOT NULL DEFAULT  '' COMMENT '身份证号码',
  level SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员等级',
  avatar VARCHAR(255) NOT NULL DEFAULT '' COMMENT '会员头像',
  email VARCHAR(100) NOT NULL DEFAULT '' COMMENT '电子邮箱',
  mobile VARCHAR(11) NOT NULL DEFAULT '' COMMENT '手机号码',
  alipay_contact VARCHAR(32) NOT NULL DEFAULT '' COMMENT '支付宝姓名',
  alipay_no VARCHAR(32) NOT NULL DEFAULT '' COMMENT '支付宝账号',
  register_ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT '注册IP',
  login_count INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '登录次数',
  login_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '登录时间',
  login_ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT '登录IP',
  total_money DECIMAL(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '累计金额',
  blance_money DECIMAL(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '可用余额',
  frozen_money DECIMAL(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '冻结金额',
  total_integral INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '累计积分',
  blance_integral INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '可用积分',
  frozen_integral INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '冻结积分',
  experience INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员经验值',
  signin_days_total INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '签到总天数',
  signin_days_series INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '连续签到天数（中断清零）',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁止',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  remark VARCHAR(120) NOT NULL DEFAULT  '' COMMENT '备注信息',
  street VARCHAR(60) NOT NULL DEFAULT '' COMMENT '街道',
  city VARCHAR(60) NOT NULL DEFAULT '' COMMENT '城市',
  province VARCHAR(60) NOT NULL DEFAULT '' COMMENT '省份',
  country VARCHAR(60) NOT NULL DEFAULT '' COMMENT '国家',
  wx_openid VARCHAR(32) NOT NULL DEFAULT '' COMMENT '微信openId',
  wx_unionid VARCHAR(32) NOT NULL DEFAULT '' COMMENT '微信unionId',
  promoter_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '推广员ID',
  android_id VARCHAR(32) NOT NULL DEFAULT '' COMMENT '安卓ID',
  oaid VARCHAR(64) NOT NULL DEFAULT '' COMMENT '广告联盟ID',
  is_virtual TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否虚拟用户:1=是,2=否',
  PRIMARY KEY (id),
  KEY k_member_name (member_name),
  KEY k_mobile (mobile),
  KEY k_wx_openid (wx_openid),
  KEY k_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员管理?module=会员';

-- ----------------------------
-- 等级管理
-- ----------------------------
DROP TABLE IF EXISTS es_member_level;
CREATE TABLE IF NOT EXISTS es_member_level (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  title VARCHAR(60) NOT NULL COMMENT '标题',
  name VARCHAR(30) NOT NULL COMMENT '名称',
  value TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '等级值',
  icon VARCHAR(50) NOT NULL DEFAULT '' COMMENT '图标',
  experience INT UNSIGNED NOT NULL COMMENT '所需经验值',
  extra VARCHAR(200) NOT NULL DEFAULT '' COMMENT '扩展数据',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_value (value)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='等级管理?module=会员';

-- ----------------------------
-- 积分日志管理
-- ----------------------------
DROP TABLE IF EXISTS es_member_integral_log;
CREATE TABLE IF NOT EXISTS es_member_integral_log (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  integral INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '变更积分',
  memo VARCHAR(200) NOT NULL DEFAULT '' COMMENT '变更原因',
  param JSON COMMENT '提交参数',
  ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT 'IP',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='积分日志管理?module=会员';

-- ----------------------------
-- 收货地址管理
-- ----------------------------
DROP TABLE IF EXISTS es_member_address;
CREATE TABLE IF NOT EXISTS es_member_address (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  realname VARCHAR(60) NOT NULL COMMENT '姓名',
  mobile VARCHAR(11) NOT NULL COMMENT '手机号',
  province VARCHAR(60) NOT NULL COMMENT '省份',
  city VARCHAR(150) NOT NULL COMMENT '城市',
  street VARCHAR(150) NOT NULL COMMENT '街道',
  detail VARCHAR(250) NOT NULL DEFAULT '' COMMENT '详细地址',
  post_code VARCHAR(6) NOT NULL DEFAULT '' COMMENT '邮编',
  longitude DOUBLE(10,6) NOT NULL DEFAULT 0 COMMENT '经度（分米级）',
  latitude DOUBLE(10,6) NOT NULL DEFAULT 0 COMMENT '纬度（分米级）',
  is_default TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否默认:1=是,2=否',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='收货地址管理?module=会员';

-- ----------------------------
-- 会员日志管理
-- ----------------------------
DROP TABLE IF EXISTS es_member_log;
CREATE TABLE IF NOT EXISTS es_member_log (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员ID',
  title VARCHAR(100) NOT NULL DEFAULT '' COMMENT '日志标题',
  operate VARCHAR(16) NOT NULL DEFAULT '' COMMENT '操作:LOGIN=登录,SAVE=新增,UPDATE=编辑,DELETE=删除',
  level VARCHAR(16) NOT NULL DEFAULT 'INFO' COMMENT '日志等级:DEBUG=调试,INFO=信息,WARNING=警告,DANGER=危险,ERROR=错误,EXCEPTION=异常',
  param JSON COMMENT '提交参数',
  content TEXT COMMENT '日志详情',
  ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT 'IP',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=成功,2=失败',
  created_at INT UNSIGNED NOT NULL COMMENT '操作时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id),
  FULLTEXT INDEX ftk_content(title, operate, content) WITH PARSER ngram,
  FULLTEXT INDEX ftk_title(title, operate) WITH PARSER ngram
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员日志管理?module=会员';

-- ----------------------------
--  收藏管理
-- ----------------------------
DROP TABLE IF EXISTS es_member_favorite;
CREATE TABLE IF NOT EXISTS es_member_favorite (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  item_id INT UNSIGNED NOT NULL COMMENT '项目ID',
  item_type VARCHAR(30) NOT NULL COMMENT '项目类型:INDEX=首页,PRODUCT_CATEGORY=商品分类,PRODUCT_DETAIL=商品详情,SHOPPINGCART=购物车,ARTICLE_LIST=文章列管理,ARTICLE_CATEGORY=文章分类,ARTICLE_DETAIL=文章详情',
  tags VARCHAR(60) NOT NULL DEFAULT '' COMMENT '标签（逗号隔开）',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id),
  KEY k_item_id (item_id, item_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='收藏管理?module=会员';

-- ----------------------------
--  足迹管理
-- ----------------------------
DROP TABLE IF EXISTS es_member_browsing;
CREATE TABLE IF NOT EXISTS es_member_browsing (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  item_id INT UNSIGNED NOT NULL COMMENT '项目ID',
  item_type VARCHAR(30) NOT NULL COMMENT '项目类型:INDEX=首页,PRODUCT_CATEGORY=商品分类,PRODUCT_DETAIL=商品详情,SHOPPINGCART=购物车,ARTICLE_LIST=文章列管理,ARTICLE_CATEGORY=文章分类,ARTICLE_DETAIL=文章详情',
  tags VARCHAR(60) NOT NULL DEFAULT '' COMMENT '标签（逗号隔开）',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id),
  KEY k_item_id (item_id, item_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='足迹管理?module=会员';
,
-- ++++++++++++++++++++ 商品模块 ++++++++++++++++++++

-- ----------------------------
-- 商品管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_spu;
CREATE TABLE IF NOT EXISTS es_product_spu (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  category_id INT UNSIGNED NOT NULL COMMENT '分类ID',
  brand_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '品牌ID',
  -- warehouse_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '仓库商品ID',
  title VARCHAR(150) NOT NULL COMMENT '商品名称',
  price DECIMAL(8,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '售价',
  market_price DECIMAL(8,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '市场价',
  sku_min_price DECIMAL(8,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT 'SKU最低价',
  sku_max_price DECIMAL(8,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT 'SKU最高价',
  virtual_price INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '虚拟面值',
  is_virtual TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否虚拟商品:1=是,2=否',
  is_have_gift TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否包含赠品:1=是,2=否',
  give_integral INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '赠送积分',
  -- commission_money DECIMAL(8,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '推广佣金',
  weight DOUBLE UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品重量（千克）',
  delivery_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '运费模板ID', 
  -- postage_money SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '默认运费',
  spec_type TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '规格类型:1=单规格,2=多规格',
  deduct_stock_type TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '减库存方式:1=付款减库存,2=下单减库存',
  unit_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '计量单位ID',
  stock INT UNSIGNED NOT NULL COMMENT '库存量',
  warning_stock SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '库存警告',
  sales_quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '销量',
  comments_quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '评论数量',
  icon VARCHAR(255) NOT NULL COMMENT '列表图标（单张容量最大1024KB，800px/800px）',
  carousel_images VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '详情页轮播图（单张容量最大1024KB，800px/800px）',
  video_url VARCHAR(200) NOT NULL DEFAULT '' COMMENT '短视频',
  intro VARCHAR(255) NOT NULL DEFAULT '' COMMENT '商品简介',
  description TEXT COMMENT '商品描述（单张容量最大512KB，宽度750px以内）',
  promotion_tags VARCHAR(200) NOT NULL DEFAULT '' COMMENT '促销标签:NEW=最新,HOT=热销,RECO=推荐,CHOI=精选,NEXP=临期,DISC=折扣,SPEC=特价,APPO=预约,PRES=预售,LIMI=限量,FLUS=限时,KILL=秒杀',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=上架,2=待上架,3=售罄,4=下架,5=预售',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  expired_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品过期时间',
  -- sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  mch_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
  PRIMARY KEY (id),
  KEY k_category_id (category_id),
  KEY k_title (title),
  KEY k_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品管理?module=商品';

-- ----------------------------
-- 商品类别管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_category;
CREATE TABLE IF NOT EXISTS es_product_category (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  level TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '层级',
  title VARCHAR(60) NOT NULL COMMENT '标题',
  icon VARCHAR(200) NOT NULL DEFAULT '' COMMENT '图标',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_pid (pid),
  KEY k_status (status),
  KEY k_sort (sort)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品分类管理?module=商品';

-- ----------------------------
--  SKU管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_sku;
CREATE TABLE IF NOT EXISTS es_product_sku (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  sku_no VARCHAR(60) NOT NULL COMMENT 'SKU编码',
  goods_id INT UNSIGNED NOT NULL COMMENT '商品ID',
  price DECIMAL(10,2) NOT NULL COMMENT '价格',
  stock INT UNSIGNED NOT NULL COMMENT '库存量',
  sales_quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '销量',
  weight DOUBLE UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品重量（千克）',
  package_length INT NOT NULL DEFAULT 0 COMMENT '包装长度',
  package_width INT NOT NULL DEFAULT 0 COMMENT '包装宽度',
  package_height INT NOT NULL DEFAULT 0 COMMENT '包装高度',
  is_default TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否默认展示:1=是,2=否',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=上架,2=下架',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  expired_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期时间',
  PRIMARY KEY (id),
  KEY k_sku_no (sku_no),
  KEY k_expired_time (expired_time),
  UNIQUE KEY k_goods_id (goods_id, sku_no)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='SKU管理?module=商品';

-- ----------------------------
--  商品属性管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_attribute;
CREATE TABLE IF NOT EXISTS es_product_attribute (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  category_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '类别ID',
  title VARCHAR(60) NOT NULL COMMENT '属性名称',
  is_filter TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否允许筛选:1=是,2=否',
  is_parameter TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否商品参数:1=是,2=否',
  is_custom TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否自定义属性:1=是,2=否',
  default_value VARCHAR(2048) NOT NULL DEFAULT '' COMMENT '组件默认值',
  component_name VARCHAR(30) NOT NULL COMMENT '组件名称:TEXT=文本框,NUMBER=数字输入框,SELECT=下拉框',
  component_dataset VARCHAR(200) NOT NULL DEFAULT '' COMMENT '组件数据源',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_pid (pid),
  KEY k_category_id (category_id),
  KEY k_sort (sort)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='属性管理?module=商品';

-- ----------------------------
--  商品规格管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_specification;
CREATE TABLE IF NOT EXISTS es_product_specification (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  category_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '类别ID',
  title VARCHAR(60) NOT NULL COMMENT '属性名称',
  is_filter TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否允许筛选:1=是,2=否',
  is_parameter TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否商品参数:1=是,2=否',
  is_custom TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否自定义属性:1=是,2=否',
  default_value VARCHAR(2048) NOT NULL DEFAULT '' COMMENT '组件默认值',
  component_name VARCHAR(30) NOT NULL COMMENT '组件名称:TEXT=文本框,NUMBER=数字输入框,SELECT=下拉框',
  component_dataset VARCHAR(200) NOT NULL DEFAULT '' COMMENT '组件数据源',
  value VARCHAR(2048) NOT NULL DEFAULT '' COMMENT '规格值',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_pid (pid),
  KEY k_category_id (category_id),
  KEY k_sort (sort)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='规格管理?module=商品';

-- ----------------------------
--  商品关联管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_relationship;
CREATE TABLE IF NOT EXISTS es_product_relationship (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  goods_id INT UNSIGNED NOT NULL COMMENT '商品ID',
  goods_type VARCHAR(3) NOT NULL DEFAULT 'SPU' COMMENT '商品类型:SPU=SPU,SKU=SKU',
  item_id INT UNSIGNED NOT NULL COMMENT '项目ID',
  item_type VARCHAR(20) NOT NULL DEFAULT '' COMMENT '项目类型:ATTR=属性,BRAN=品牌,TAG=标签,SPEC=规格',
  item_value VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '项目值',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_goods_id (goods_id, goods_type),
  KEY k_item_id (item_id, item_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品关联管理?module=商品';

-- ----------------------------
-- 商品相册管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_album;
CREATE TABLE IF NOT EXISTS es_product_album (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  goods_id INT UNSIGNED NOT NULL COMMENT '商品ID',
  title VARCHAR(60) NOT NULL COMMENT '图片名称',
  url VARCHAR(200) NOT NULL DEFAULT '' COMMENT '网址路径',
  width VARCHAR(30) NOT NULL DEFAULT '' COMMENT '图片宽度',
  height VARCHAR(30) NOT NULL DEFAULT '' COMMENT '图片高度',
  mime_type VARCHAR(30) NOT NULL DEFAULT '' COMMENT 'MIME类型:',
  file_size INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '文件大小',
  file_type VARCHAR(30) NOT NULL DEFAULT '' COMMENT '文件类型:IMAGE=图片,VIDEO=视频',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品相册管理?module=商品';

-- ----------------------------
-- 品牌管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_brand;
CREATE TABLE IF NOT EXISTS es_product_brand (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  category_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '分类ID',
  title VARCHAR(60) NOT NULL COMMENT '品牌名称',
  icon VARCHAR(200) NOT NULL DEFAULT '' COMMENT '图标',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_category_id (category_id),
  KEY k_status (status),
  KEY k_sort (sort)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='品牌管理?module=商品';

-- ----------------------------
--  标签管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_tag;
CREATE TABLE IF NOT EXISTS es_product_tag (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  category_id INT UNSIGNED NOT NULL COMMENT '类别ID',
  title VARCHAR(60) NOT NULL COMMENT '标签名称',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_category_id (category_id),
  KEY k_sort (sort)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='标签管理?module=商品';

-- ----------------------------
--  计量单位管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_unit;
CREATE TABLE IF NOT EXISTS es_product_unit (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  category_id INT UNSIGNED NOT NULL COMMENT '类别ID',
  title VARCHAR(60) NOT NULL COMMENT '标签名称',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_category_id (category_id),
  KEY k_sort (sort)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='计量单位管理?module=商品';

-- ----------------------------
-- 评论管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_review;
CREATE TABLE IF NOT EXISTS es_product_review (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  goods_id INT UNSIGNED NOT NULL COMMENT '商品ID',
  order_id INT UNSIGNED NOT NULL COMMENT '订单ID',
  rating TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '评分',
  product_score TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品分数',
  service_score TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '服务分数',
  content VARCHAR(500) NOT NULL COMMENT '评论内容',
  images TEXT COMMENT '图片',
  is_anonymous TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否匿名:1=是,2=否',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  created_at INT UNSIGNED NOT NULL COMMENT '评论时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  deleted_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id),
  KEY k_goods_id (goods_id),
  KEY k_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='评论管理?module=商品';

-- ----------------------------
-- 商品日志管理
-- ----------------------------
DROP TABLE IF EXISTS es_product_log;
CREATE TABLE IF NOT EXISTS es_product_log (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  title VARCHAR(100) NOT NULL DEFAULT '' COMMENT '标题',
  operate VARCHAR(16) NOT NULL DEFAULT '' COMMENT '操作:SALES=销售,RETURN=退货,SAVE=新增,UPDATE=编辑,DELETE=删除',
  level VARCHAR(16) NOT NULL DEFAULT 'INFO' COMMENT '日志等级:DEBUG=调试,INFO=信息,WARNING=警告,DANGER=危险,ERROR=错误,EXCEPTION=异常',
  param JSON COMMENT '参数信息',
  ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT 'IP',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=成功,2=失败',
  created_at INT UNSIGNED DEFAULT NULL COMMENT '创建时间',
  item_id INT UNSIGNED NOT NULL COMMENT '商品ID',
  item_title VARCHAR(150) NOT NULL COMMENT '商品名称',
  item_icon VARCHAR(255) NOT NULL DEFAULT '' COMMENT '图标',
  price DECIMAL(8,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '价格',
  quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '数量',
  total_money DECIMAL(8,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '金额',
  PRIMARY KEY (id),
  KEY k_item_id (item_id),
  KEY k_item_title (item_title),
  KEY k_operate (operate)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品日志管理?module=商品';
,
-- ++++++++++++++++++++ 文章模块 ++++++++++++++++++++

-- ----------------------------
-- 文章管理
-- ----------------------------
DROP TABLE IF EXISTS es_article;
CREATE TABLE IF NOT EXISTS es_article (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',  
  category_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '分类ID',
  title VARCHAR(255) NOT NULL COMMENT '标题',
  author VARCHAR(30) NOT NULL DEFAULT '' COMMENT '作者',
  source_link VARCHAR(255) NOT NULL DEFAULT '' COMMENT '原文链接',
  icon VARCHAR(255) NOT NULL DEFAULT '' COMMENT '图标',
  summary VARCHAR(255) NOT NULL DEFAULT '' COMMENT '摘要',
  visit_count INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '浏览次数',
  is_hot TINYINT NOT NULL DEFAULT 0 COMMENT '是否热门:1=是,2=否',
  is_recommend TINYINT NOT NULL DEFAULT 0 COMMENT '是否推荐:1=是,2=否',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  content TEXT NOT NULL COMMENT '内容',
  PRIMARY KEY (id),
  KEY k_title (title),
  KEY k_category_id (category_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文章管理?module=内容';

-- ----------------------------
-- 文章分类管理
-- ----------------------------
DROP TABLE IF EXISTS es_article_category;
CREATE TABLE IF NOT EXISTS es_article_category (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  title VARCHAR(30) NOT NULL COMMENT '标题',
  intro VARCHAR(200) NOT NULL DEFAULT '' COMMENT '简介',
  icon VARCHAR(255) NOT NULL DEFAULT '' COMMENT '图标',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_pid (pid),
  KEY k_sort (sort),
  KEY k_status(status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='分类管理?module=内容';

-- ----------------------------
-- 单页管理
-- ----------------------------
DROP TABLE IF EXISTS es_article_page;
CREATE TABLE IF NOT EXISTS es_article_page (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',  
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  is_content TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否内容:1=内容,2=节点',
  title VARCHAR(255) NOT NULL COMMENT '标题',
  icon VARCHAR(255) NOT NULL DEFAULT '' COMMENT '图标',
  summary VARCHAR(255) NOT NULL DEFAULT '' COMMENT '摘要',
  visit_count INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '浏览次数',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  content TEXT NOT NULL COMMENT '内容',
  PRIMARY KEY (id),
  KEY k_title (title),
  KEY k_pid (pid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='单页管理?module=内容';
,
-- ++++++++++++++++++++ 权限模块 ++++++++++++++++++++

-- ----------------------------
-- 管理员管理
-- ----------------------------
DROP TABLE IF EXISTS es_auth_admin;
CREATE TABLE IF NOT EXISTS es_auth_admin (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  username VARCHAR(60) NOT NULL COMMENT '用户名',
  nickname VARCHAR(60) NOT NULL DEFAULT '' COMMENT '昵称',
  realname VARCHAR(60) NOT NULL DEFAULT '' COMMENT '姓名',
  password VARCHAR(32) NOT NULL COMMENT '密码',
  salt VARCHAR(10) NOT NULL DEFAULT '' COMMENT '密码盐',
  avatar VARCHAR(200) NOT NULL DEFAULT '' COMMENT '头像',
  email VARCHAR(100) NOT NULL DEFAULT '' COMMENT '电子邮箱',
  mobile VARCHAR(11) NOT NULL DEFAULT '' COMMENT '手机号码',
  gender TINYINT UNSIGNED NOT NULL DEFAULT 3 COMMENT '性别:1=男,2=女,3=未知',
  login_count INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '登录次数',
  login_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '登录时间',
  login_ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT '登录IP',
  register_ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT '注册IP',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用,3=待审核,4=审核驳回',
  created_at INT UNSIGNED NOT NULL COMMENT '注册时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  UNIQUE KEY uk_username (username),
  KEY k_mobile (mobile)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员管理?module=权限';

-- ----------------------------
-- 角色管理
-- ----------------------------
DROP TABLE IF EXISTS es_auth_role;
CREATE TABLE IF NOT EXISTS es_auth_role (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  title VARCHAR(60) NOT NULL DEFAULT '' COMMENT '标题',
  name VARCHAR(30) NOT NULL COMMENT '名称',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色管理?module=权限';

-- ----------------------------
-- 菜单管理
-- ----------------------------
DROP TABLE IF EXISTS es_auth_menu;
CREATE TABLE IF NOT EXISTS es_auth_menu (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  title VARCHAR(60) NOT NULL COMMENT '标题',
  app VARCHAR(30) NOT NULL DEFAULT '' COMMENT '应用名称',
  module VARCHAR(30) NOT NULL DEFAULT '' COMMENT '模块名称',
  controller VARCHAR(60) NOT NULL DEFAULT '' COMMENT '控制器名称',
  action VARCHAR(60) NOT NULL DEFAULT '' COMMENT '操作名称',
  type TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '类型:1=分类,2=菜单,3=按钮',
  icon VARCHAR(200) NOT NULL DEFAULT '' COMMENT '菜单图标',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_pid (pid),
  KEY k_sort (sort)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='菜单管理?module=权限';

-- ----------------------------
-- 访问控制管理
-- ----------------------------
DROP TABLE IF EXISTS es_auth_casbin;
CREATE TABLE IF NOT EXISTS es_auth_casbin (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  rule_type VARCHAR(2) NOT NULL DEFAULT '' COMMENT '规则类型:g=定义角色,e=策略作用,p=定义策略,r=定义请求,pu=定义用户策略,pr=定义角色策略',
  subject VARCHAR(60) NOT NULL DEFAULT '' COMMENT '主体',
  object VARCHAR(60) NOT NULL DEFAULT '' COMMENT '对象',
  action VARCHAR(60) NOT NULL DEFAULT '' COMMENT '行为',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  UNIQUE KEY uk_primary (rule_type, subject, object, action)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='访问控制管理?module=权限';

-- ----------------------------
-- 管理员日志管理
-- ----------------------------
DROP TABLE IF EXISTS es_auth_log;
CREATE TABLE IF NOT EXISTS es_auth_log (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  username VARCHAR(60) NOT NULL DEFAULT '' COMMENT '用户名',
  title VARCHAR(100) NOT NULL DEFAULT '' COMMENT '标题',
  operate VARCHAR(16) NOT NULL DEFAULT '' COMMENT '操作:LOGIN=登录,SAVE=新增,UPDATE=编辑,DELETE=删除',
  level VARCHAR(16) NOT NULL DEFAULT 'INFO' COMMENT '日志等级:DEBUG=调试,INFO=信息,WARNING=警告,DANGER=危险,ERROR=错误,EXCEPTION=异常',
  path VARCHAR(200) NOT NULL DEFAULT '' COMMENT '操作路径（URL或文件路径）',
  param JSON COMMENT '参数信息',
  content TEXT COMMENT '日志详情',
  ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT 'IP',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=成功,2=失败',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_username (username),
  KEY k_operate (operate),
  FULLTEXT INDEX ftk_content (title, operate, content) WITH PARSER ngram,
  FULLTEXT INDEX ftk_title (title, operate) WITH PARSER ngram
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员日志管理?module=权限';
,
-- ++++++++++++++++++++ 系统模块 ++++++++++++++++++++

-- ----------------------------
-- 系统配置管理
-- ----------------------------
DROP TABLE IF EXISTS es_system_config;
CREATE TABLE IF NOT EXISTS es_system_config (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  title VARCHAR(100) NOT NULL COMMENT '标题',
  tip VARCHAR(100) NOT NULL DEFAULT '' COMMENT '提示',
  -- group_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '分组ID',
  group_name VARCHAR(60) NOT NULL COMMENT '分组名称',
  name VARCHAR(60) NOT NULL COMMENT '名称',
  value VARCHAR(5120) NOT NULL DEFAULT '' COMMENT '变量值',
  default_value VARCHAR(2048) NOT NULL DEFAULT '' COMMENT '组件默认值',
  component_name VARCHAR(30) NOT NULL COMMENT '组件名称:textbox=文本框,numbox=数字输入框,datebox=日期输入框,datetimebox=日期时间输入框,textarea=多行文本输入框,select=下拉框,radio=单选框,checkbox=复选框,imageuploader=图片上传组件,fileuploader=文件上传组件,editor=可视化编辑器',
  component_dataset VARCHAR(200) NOT NULL DEFAULT '' COMMENT '组件数据源',
  validate_rule VARCHAR(100) NOT NULL DEFAULT '' COMMENT '验证规则（参照PHP框架的验证规则内容）',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=启用,2=禁用',
  is_locked TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否锁定:1=是,2=否',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  UNIQUE KEY uk_title (title, group_name),
  KEY k_group_name (group_name),
  KEY k_sort (sort)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统配置管理?module=系统';

-- ----------------------------
-- 配置分组管理
-- ----------------------------
DROP TABLE IF EXISTS es_system_config_group;
CREATE TABLE IF NOT EXISTS es_system_config_group (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  title VARCHAR(60) NOT NULL COMMENT '标题',
  tip VARCHAR(100) NOT NULL DEFAULT '' COMMENT '提示',
  name VARCHAR(60) NOT NULL COMMENT '名称',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=正常,2=禁用',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  UNIQUE KEY uk_title (title)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置分组管理?module=系统';

-- ----------------------------
-- 地区数据管理
-- ----------------------------
DROP TABLE IF EXISTS es_system_region;
CREATE TABLE IF NOT EXISTS es_system_region (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '城市ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  deep TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '层级深度',
  name VARCHAR(32) NOT NULL COMMENT '精简名称',
  pinyin_prefix VARCHAR(3) NOT NULL COMMENT '首字母',
  pinyin VARCHAR(80) NOT NULL COMMENT '完整拼音',
  ext_id BIGINT UNSIGNED NOT NULL COMMENT '完整地区ID（12位）',
  ext_name VARCHAR(32) NOT NULL COMMENT '完整名称',
  PRIMARY KEY (id),
  KEY k_pid (pid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='地区数据管理?module=系统';

-- ----------------------------
-- 验证码管理
-- ----------------------------
DROP TABLE IF EXISTS es_system_captcha;
CREATE TABLE IF NOT EXISTS es_system_captcha (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  type VARCHAR(30) NOT NULL DEFAULT '' COMMENT '类型:EMAIL=电子邮件,SMS=手机短信',
  event VARCHAR(30) NOT NULL COMMENT '事件:REGIST=账号注册,CONFIRM=操作确认,PROMOTION=促销活动,OTHER=其他',
  to VARCHAR(100) NOT NULL COMMENT '接收方',
  code VARCHAR(128) NOT NULL COMMENT '验证码',
  max_count SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '最大重发次数',
  resend_count SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '已重发次数',
  resend_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '下次重发时间',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=成功,2=失败,3=发送中,4=已过期',
  ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT 'IP',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id),
  KEY k_to (to, event)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='验证码管理?module=系统';

-- ----------------------------
-- 留言反馈管理
-- ----------------------------
DROP TABLE IF EXISTS es_system_feedback;
CREATE TABLE IF NOT EXISTS es_system_feedback (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  realname VARCHAR(50) NOT NULL COMMENT '姓名',
  mobile VARCHAR(11) NOT NULL COMMENT '手机号',
  email VARCHAR(50) NOT NULL COMMENT '电子邮箱',
  category VARCHAR(32) NOT NULL COMMENT '反馈类别',
  content VARCHAR(5000) NOT NULL COMMENT '反馈内容',
  images VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '截图',
  is_read TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否已阅:1=是,2=否',
  is_anonymous TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否匿名:1=是,2=否',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=显示,2=隐藏,3=待审核,4=审核驳回',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户反馈管理?module=系统';

-- ----------------------------
-- 附件管理
-- ----------------------------
DROP TABLE IF EXISTS es_system_attachment;
CREATE TABLE IF NOT EXISTS es_system_attachment (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  category_id INT UNSIGNED NOT NULL COMMENT '分类ID',
  orgin_name varchar(150) NOT NULL DEFAULT '' COMMENT '原始文件名',
  file_name varchar(150) NOT NULL DEFAULT '' COMMENT '文件名',
  url VARCHAR(200) NOT NULL DEFAULT '' COMMENT '网址路径',
  path VARCHAR(200) NOT NULL DEFAULT '' COMMENT '物理路径',
  storage_type VARCHAR(100) NOT NULL DEFAULT 'local' COMMENT '存储类型:local=本地,remote=网络',
  image_width VARCHAR(30) NOT NULL DEFAULT '' COMMENT '宽度',
  image_height VARCHAR(30) NOT NULL DEFAULT '' COMMENT '高度',
  image_frames TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '图片帧数',
  file_size INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '文件大小',
  mime_type VARCHAR(30) NOT NULL DEFAULT '' COMMENT 'mime类型:',
  file_ext VARCHAR(6) NOT NULL DEFAULT '' COMMENT '文件后缀',
  file_type VARCHAR(30) NOT NULL DEFAULT '' COMMENT '文件类型:image=图片,audio=音频,video=视频,doc=文档,app=应用,zip=压缩包,code=脚本',
  item_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '项目ID',
  item_name VARCHAR(60) NOT NULL DEFAULT '' COMMENT '项目名称',
  item_type VARCHAR(60) NOT NULL DEFAULT '' COMMENT '交易类型',
  extra VARCHAR(200) NOT NULL DEFAULT '' COMMENT '扩展数据',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='附件管理?module=系统';

-- ----------------------------
-- 附件类别管理（由用户创建）
-- ----------------------------
DROP TABLE IF EXISTS es_system_attachment_category;
CREATE TABLE IF NOT EXISTS es_system_attachment_category (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  title VARCHAR(60) NOT NULL COMMENT '标题',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  UNIQUE KEY uk_title (title(16)),
  KEY k_sort (sort)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='附件类别管理?module=系统';

-- ----------------------------
-- 定时任务管理
-- ----------------------------
DROP TABLE IF EXISTS es_system_crontab;
CREATE TABLE IF NOT EXISTS es_system_crontab (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  type VARCHAR(10) NOT NULL COMMENT '任务类型:url=请求URL,sql=执行SQL,shell=执行Shell',
  title VARCHAR(60) NOT NULL COMMENT '任务标题',
  content VARCHAR(5000) NOT NULL COMMENT '任务内容（url,sql,shell）',
  schedule VARCHAR(100) NOT NULL COMMENT '执行周期（Crontab格式:min* hour* day* month* weekday*）',
  max_count INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '最大执行次数（0为不限）',
  exec_count INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '已执行次数',
  exec_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '最后执行时间',
  start_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '开始时间',
  end_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '结束时间',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=启用,2=禁用,2=已过期,3=已完成',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='定时任务管理?module=系统';

-- ----------------------------
-- 定时任务日志管理
-- ----------------------------
DROP TABLE IF EXISTS es_system_crontab_log;
CREATE TABLE IF NOT EXISTS es_system_crontab_lob (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  crontab_id INT UNSIGNED NOT NULL COMMENT '任务ID',
  start_time INT UNSIGNED NOT NULL COMMENT '开始时间',
  end_time INT UNSIGNED NOT NULL COMMENT '结束时间',
  exec_duration INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行耗时',
  result TEXT COMMENT '执行结果',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=成功,2=失败',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_crontab_id (crontab_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='定时任务日志管理?module=系统';

-- ----------------------------
-- 系统消息管理（站内信、系统消息等）
-- ----------------------------
DROP TABLE IF EXISTS es_system_message;
CREATE TABLE IF NOT EXISTS es_system_message (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  from_member_id INT UNSIGNED NOT NULL COMMENT '发件人ID',
  folder VARCHAR(16) NOT NULL DEFAULT 'SEND' COMMENT '发件人文件夹:INBOX=收件箱,SEND=已发送,DRAFTS=草稿箱,JUNK=小黑屋,TRASH=回收站',
  type VARCHAR(16) NOT NULL DEFAULT 'PM' COMMENT '类型:SYS=系统消息,PM=站内信',
  title VARCHAR(60) NOT NULL COMMENT '标题',
  content VARCHAR(1000) NOT NULL COMMENT '消息内容',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=已发送,2=草稿',
  read_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '阅读时间',
  deleted_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id),
  KEY k_folder (folder)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统消息管理?module=系统';

-- ----------------------------
-- 系统通知管理
-- ----------------------------
DROP TABLE IF EXISTS es_system_notice;
CREATE TABLE IF NOT EXISTS es_system_notice (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  level VARCHAR(16) NOT NULL DEFAULT 'NORMAL' COMMENT '级别:NORMAL=普通,DANGER=危险,WARNING=警告,URGENCY=紧急',
  title VARCHAR(60) NOT NULL COMMENT '标题',
  content VARCHAR(500) NOT NULL COMMENT '消息内容',
  read_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '阅读时间',
  deleted_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统通知管理?module=系统';

-- ----------------------------
-- 应用程序版本管理
-- ----------------------------
DROP TABLE IF EXISTS es_system_version;
CREATE TABLE IF NOT EXISTS es_system_version (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  version_name VARCHAR(32) NOT NULL COMMENT '版本名称（例如：1.0.0）',
  version_id INT UNSIGNED NOT NULL DEFAULT 1 COMMENT '版本号（例如：100）',
  os_type VARCHAR(20) NOT NULL DEFAULT '' COMMENT '系统类型:android=安卓,ios=苹果',
  download_url VARCHAR(200) NOT NULL COMMENT '下载链接',
  bytes VARCHAR(16) NOT NULL DEFAULT '0B' COMMENT '安装包大小',
  content VARCHAR(500) NOT NULL COMMENT '更新内容',
  is_force TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否强制更新:1=是,2=否',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=启用,2=禁用',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用程序版本管理?module=系统';
,
-- ++++++++++++++++++++ 营销模块 ++++++++++++++++++++

-- ----------------------------
-- 分销管理
-- ----------------------------
DROP TABLE IF EXISTS es_marketing_promoter;
CREATE TABLE IF NOT EXISTS es_marketing_promoter (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  parent2_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '二级推广员ID',
  parent1_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '一级推广员ID',
  total_commission_money DECIMAL(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '下线累计贡献给我的收益',
  child1_commission_money DECIMAL(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '一级下线给我的累计贡献收益',
  child2_commission_money DECIMAL(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '二级下线给我的累计贡献收益',
  total_quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '累计下线人数',
  child1_quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '我的一级下线人数',
  child2_quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '我的二级下线人数',
  total_withdrawal_money DECIMAL(10,0) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '累计提现金额',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=已审核,2=审核中,3=已冻结,4=已注销',
  created_at INT UNSIGNED NOT NULL COMMENT '申请时间',
  updated_at INT UNSIGNED NOT NULL COMMENT '更新时间',
  deleted_at INT UNSIGNED NOT NULL COMMENT '注销时间',
  audited_time INT UNSIGNED NOT NULL COMMENT '审核时间',
  PRIMARY KEY (id),
  KEY k_member_id (member_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='分销管理?module=营销';

-- ----------------------------
-- 优惠券管理
-- ----------------------------
DROP TABLE IF EXISTS es_marketing_coupon;
CREATE TABLE IF NOT EXISTS es_marketing_coupon (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  title VARCHAR(60) NOT NULL COMMENT '名称',
  code VARCHAR(32) NOT NULL DEFAULT '' COMMENT '兑换码',
  integral INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '兑换消耗积分值',
  price INT UNSIGNED NOT NULL COMMENT '优惠券面值',
  min_money DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '最低消费金额',
  start_time INT UNSIGNED NOT NULL COMMENT '开始时间',
  end_time INT UNSIGNED NOT NULL COMMENT '结束时间',
  expired_time INT UNSIGNED NOT NULL COMMENT '优惠券有效期',
  quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '可领数量',
  total_quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '总数量',
  received_quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '已领数量',
  is_unlimited TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '是否不限数量:1=是,2=否',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=启用,2=禁用,2=已过期,3=已领完',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_time_range (start_time, end_time),
  KEY k_quantity (quantity),
  KEY k_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优惠券管理?module=营销';

-- ----------------------------
-- 优惠券领取管理
-- ----------------------------
DROP TABLE IF EXISTS es_marketing_coupon_received;
CREATE TABLE IF NOT EXISTS es_marketing_coupon_received (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  coupon_id INT UNSIGNED NOT NULL COMMENT '优惠券ID',
  coupon_title VARCHAR(60) NOT NULL COMMENT '优惠券名称',
  coupon_price INT UNSIGNED NOT NULL COMMENT '优惠券面值',
  min_money DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '最低消费金额',
  order_id INT UNSIGNED NOT NULL COMMENT '订单ID',
  order_money DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '实际消费金额',
  created_at INT UNSIGNED NOT NULL COMMENT '领取时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用时间',
  expired_time INT UNSIGNED NOT NULL COMMENT '优惠券有效期',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=已使用,2=未使用,3=已冻结,4=已过期',
  PRIMARY KEY (id),
  KEY k_coupon_id (coupon_id),
  KEY k_member_id (member_id),
  KEY k_expired_time (expired_time),
  KEY k_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优惠券领取管理?module=营销';

-- ----------------------------
-- 商品促销推广管理
-- ----------------------------
DROP TABLE IF EXISTS es_marketing_advertising;
CREATE TABLE IF NOT EXISTS es_marketing_advertising (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  pid INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
  title VARCHAR(150) NOT NULL COMMENT '标题',
  code VARCHAR(32) NOT NULL DEFAULT '' COMMENT '代码',
  location SMALLINT NOT NULL DEFAULT 0 COMMENT '广告位置:1=登录页,100=首页,101=首页-顶部横幅轮播图,102=首页-限时促销,103=首页-大牌特卖,200=分类页,201=分类页-顶部横幅轮播图',
  type VARCHAR(32) NOT NULL DEFAULT '' COMMENT '广告类型:B=网幅广告（包含横幅、按钮、通栏、竖边、巨幅等）,T=文本链接广告,EDM=电子邮件广告,S=赞助式广告,BC=内容式广告（包含关键字广告、比对内容广告等）,C=分类式广告,I=插播式广告（一般指弹出式广告、浮动广告）,RM=富媒体（具有复杂视觉效果和交互功能的网络广告）,V=视频广告',
  media_count TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '媒体数量',
  media_width TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '宽度规范',
  media_height TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '高度规范',
  media_size VARCHAR(32) NOT NULL DEFAULT '50KB' COMMENT '文件大小规范',
  media_type VARCHAR(32) NOT NULL DEFAULT 'jpg,gif,png' COMMENT '文件格式规范',
  item_id INT UNSIGNED NOT NULL COMMENT '项目ID',
  item_type VARCHAR(30) NOT NULL COMMENT '项目类型:PRODUCT=商品,ARTICLE=文章',
  item_icon VARCHAR(255) NOT NULL DEFAULT '' COMMENT '项目图片',
  sort SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序权重',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=正常,2=禁用',
  created_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  start_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '开始时间',
  end_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '结束时间',
  PRIMARY KEY (id),
  KEY k_item_id (item_id),
  KEY k_location (location)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品促销推广管理?module=营销';
,
-- ++++++++++++++++++++ 订单模块 ++++++++++++++++++++

-- ----------------------------
-- 购物车管理
-- ----------------------------
DROP TABLE IF EXISTS es_shopping_cart;
CREATE TABLE IF NOT EXISTS es_shopping_cart (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  goods_id INT UNSIGNED NOT NULL COMMENT '商品ID',
  goods_type VARCHAR(30) NOT NULL DEFAULT '' COMMENT '商品类型:NORMAL=普通商品,MOBILE=手机充值',
  sku_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'SKU编号',
  quantity INT UNSIGNED NOT NULL COMMENT '数量',
  extra VARCHAR(200) NOT NULL DEFAULT '' COMMENT '扩展数据',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=有效,2=已失效,3=已过期',
  PRIMARY KEY (id),
  KEY k_member_id (member_id, goods_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='购物车管理?module=订单';

-- ----------------------------
-- 订单管理
-- ----------------------------
DROP TABLE IF EXISTS es_order;
CREATE TABLE IF NOT EXISTS es_order (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '买家ID',
  order_no VARCHAR(32) NOT NULL COMMENT '订单编号',
  goods_type SMALLINT NOT NULL DEFAULT 1 COMMENT '商品类型:1=普通商品,2=手机充值',
  promotion_type SMALLINT NOT NULL DEFAULT 1 COMMENT '促销类型:1=无,2=拼团订单,3=好友助力,4=秒杀订单',
  quantity INT UNSIGNED NOT NULL COMMENT '商品数量',
  pay_money DECIMAL(8,2) UNSIGNED NOT NULL COMMENT '实付金额',
  order_money DECIMAL(8,2) UNSIGNED NOT NULL COMMENT '订单金额',
  postage_money DECIMAL(8,2) UNSIGNED NOT NULL COMMENT '运费金额',
  deduction_money DECIMAL(8,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '抵扣金额',
  coupon_money DECIMAL(8,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '优惠券金额',
  coupon_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券ID',
  give_integral INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单赠送积分',
  use_integral DECIMAL(8,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '使用积分',
  extra VARCHAR(200) NOT NULL DEFAULT '' COMMENT '扩展数据',
  payment_type VARCHAR(16) NOT NULL COMMENT '支付方式:bank=银行卡,alipay=支付宝,weixin=微信',
  trade_no VARCHAR(32) NOT NULL DEFAULT '' COMMENT '第三方交易单号',
  is_visible TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否显示:1=正常,2=禁用',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '订单状态:1=待发货,2=待确认,3=待收货,4=已收货,5=已完成,6=已退款,7=已取消,8=已关闭',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  paid_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '支付时间',
  commission_status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '分销提成状态:1=已提成,2=未提成,3=已退款',
  evaluation_status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '评价状态:1=已评价,2=未评价,3=系统自动评价,4=已过期未评价',
  pay_status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '支付状态:1=已支付,2=未支付,3=已退款,4=部分退款,5=部分付款,6=已逾期',
  delivery_name VARCHAR(60) NOT NULL COMMENT '收货人姓名',
  delivery_phone VARCHAR(18) NOT NULL COMMENT '收货人电话',
  delivery_address VARCHAR(100) NOT NULL COMMENT '收货人详细地址',
  express_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '快递公司ID',
  express_no VARCHAR(32) NOT NULL DEFAULT '' COMMENT '快递单号',
  buyer_remark VARCHAR(512) NOT NULL COMMENT '买家备注',
  admin_remark VARCHAR(512) NOT NULL DEFAULT '' COMMENT '管理员备注',
  confirm_remark VARCHAR(512) NOT NULL DEFAULT '' COMMENT '订单确认备注',
  confirm_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单确认时间',
  delivery_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '发货时间',
  cancel_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '取消时间',
  receiving_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '收货时间',
  close_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单关闭时间',
  return_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '退货ID',
  device_type VARCHAR(20) NOT NULL DEFAULT '' COMMENT '设备类型:PC=电脑,ANDROID=安卓,IOS=苹果,OTHER=其他',
  PRIMARY KEY (id),
  UNIQUE KEY uk_order_no (order_no),
  KEY k_member_id (member_id),
  KEY k_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单管理?module=订单';

-- ----------------------------
-- 订单明细管理
-- ----------------------------
DROP TABLE IF EXISTS es_order_detail;
CREATE TABLE IF NOT EXISTS es_order_detail (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  order_id INT UNSIGNED NOT NULL COMMENT '订单ID',
  member_id INT UNSIGNED NOT NULL COMMENT '买家ID',
  goods_id INT UNSIGNED NOT NULL COMMENT '商品ID',
  goods_title VARCHAR(60) NOT NULL COMMENT '商品名称',
  goods_type VARCHAR(30) NOT NULL DEFAULT '' COMMENT '商品类型:NORMAL=普通商品,MOBILE=手机充值',
  goods_icon VARCHAR(255) NOT NULL COMMENT '商品图片',
  price DECIMAL(10,2) NOT NULL COMMENT '商品价格',
  quantity SMALLINT UNSIGNED NOT NULL COMMENT '商品数量',
  sku_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品SKU-ID',
  sku_no VARCHAR(60) NOT NULL DEFAULT '' COMMENT '商品SKU编号',
  tax DECIMAL(8,2) NOT NULL DEFAULT 0.00 COMMENT '税额',
  total_money DECIMAL(10,2) UNSIGNED NOT NULL COMMENT '小计金额',
  promotion_type TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '促销类型:0=默认,1=抢购商品,2=限时折扣商品,3=组合套装,4=赠品,5=拼团,6=会员等级折扣',
  virtual_price INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '虚拟面值',
  extra VARCHAR(200) NOT NULL DEFAULT '' COMMENT '扩展数据',
  status TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '交易状态:0=待确认,1=待发货,2=待收货,3=已收货,4=已退货,5=已完成,6=已取消,7=已关闭',
  PRIMARY KEY (id),
  KEY k_order_id (order_id),
  KEY k_member_id (member_id),
  KEY k_goods_id (goods_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单明细管理?module=订单';

-- ----------------------------
-- 发票管理
-- ----------------------------
DROP TABLE IF EXISTS es_order_invoice;
CREATE TABLE IF NOT EXISTS es_order_invoice (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  order_id INT UNSIGNED NOT NULL COMMENT '订单ID',
  invoice_type TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '发票类型:1=普通发票,2=增值税发票',
  invoice_title VARCHAR(50) NOT NULL DEFAULT '' COMMENT '发票抬头(普通发票',
  invoice_code VARCHAR(50) NOT NULL DEFAULT '' COMMENT '纳税人识别号(普通发票',
  invoice_content VARCHAR(10) NOT NULL DEFAULT '' COMMENT '发票内容(普通发票',
  invoice_company VARCHAR(50) NOT NULL DEFAULT '' COMMENT '单位名称',
  invoice_company_code VARCHAR(50) NOT NULL DEFAULT '' COMMENT '纳税人识别号',
  invoice_reg_address VARCHAR(50) NOT NULL DEFAULT '' COMMENT '注册地址',
  invoice_reg_phone VARCHAR(30) NOT NULL DEFAULT '' COMMENT '注册电话',
  invoice_reg_bank_name VARCHAR(60) NOT NULL DEFAULT '' COMMENT '开户银行',
  invoice_reg_bank_account VARCHAR(30) NOT NULL DEFAULT '' COMMENT '银行帐户',
  invoice_delivery_name VARCHAR(60) NOT NULL DEFAULT '' COMMENT '收票人姓名',
  invoice_delivery_phone VARCHAR(15) NOT NULL DEFAULT '' COMMENT '收票人手机号',
  invoice_delivery_addrress VARCHAR(150) NOT NULL DEFAULT '' COMMENT '收票人地址',
  PRIMARY KEY (id),
  KEY k_member_id (member_id),
  KEY k_order_id (order_id)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='发票管理?module=订单';

-- ----------------------------
-- 订单日志管理
-- ----------------------------
DROP TABLE IF EXISTS es_order_log;
CREATE TABLE IF NOT EXISTS es_order_log (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  username VARCHAR(60) NOT NULL COMMENT '管理员用户名',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  order_id INT UNSIGNED NOT NULL COMMENT '订单ID',
  title VARCHAR(100) NOT NULL DEFAULT '' COMMENT '标题',
  operate VARCHAR(16) NOT NULL DEFAULT '' COMMENT '操作:SAVE=新增,UPDATE=编辑,DELETE=删除',
  param JSON COMMENT '提交参数',
  ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT 'IP',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_order_id (order_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单日志管理?module=订单';

-- ----------------------------
--  订单退货管理
-- ----------------------------
DROP TABLE IF EXISTS es_order_return;
CREATE TABLE IF NOT EXISTS es_order_return (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  refund_no VARCHAR(32) NOT NULL COMMENT '退货编号',
  member_id INT UNSIGNED NOT NULL COMMENT '买家ID',
  order_id INT UNSIGNED NOT NULL COMMENT '订单ID',
  quantity INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '退货数量（0=全部退货）',
  amount DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '退款金额',
  return_type TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '申请类型:1=仅退款,2=退货退款',
  audit_status TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '审核状态:1=待审核,2=已同意,3=已拒绝',
  delivery_status TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '物流状态:1=待发货,2=待收货,3=未收货,4=已收货',
  images VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '退款退货凭证图片',
  buyer_remark VARCHAR(500) NOT NULL DEFAULT '' COMMENT '申请原因',
  admin_remark VARCHAR(500) NOT NULL DEFAULT '' COMMENT '管理员备注',
  express_id TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '快递编号',
  express_no VARCHAR(32) NOT NULL DEFAULT '' COMMENT '物流单号',
  delivery_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '发货时间',
  delay_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '收货延迟时间',
  receive_time INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '收货时间',
  receive_remark VARCHAR(200) NOT NULL DEFAULT '' COMMENT '收货备注',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员处理时间',
  PRIMARY KEY (id),
  KEY k_order_id (order_id),
  KEY k_member_id (member_id),
  KEY k_audit_status (audit_status)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='订单退货管理?module=订单';

-- ----------------------------
-- 物流公司管理
-- ----------------------------
DROP TABLE IF EXISTS es_order_logistics_company;
CREATE TABLE IF NOT EXISTS es_order_logistics_company (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  title VARCHAR(60) NOT NULL COMMENT '物流名称',
  company_name VARCHAR(60) NOT NULL COMMENT '公司名称',
  homepage VARCHAR(250) NOT NULL COMMENT '官网主页',
  email VARCHAR(100) NOT NULL DEFAULT '' COMMENT '电子邮箱',
  mobile VARCHAR(11) NOT NULL COMMENT '手机号码',
  realname VARCHAR(60) NOT NULL COMMENT '联系人',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=启用,2=禁用',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_company_name (company_name(16))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='物流公司管理?module=订单';

-- ----------------------------
-- 运费模板管理
-- ----------------------------
DROP TABLE IF EXISTS es_order_express;
CREATE TABLE IF NOT EXISTS es_order_express (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  title VARCHAR(60) NOT NULL COMMENT '标题',
  price DECIMAL(10,2) NOT NULL COMMENT '价格',
  status TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态:1=启用,2=禁用',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  PRIMARY KEY (id),
  KEY k_title (title(16))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='运费模板管理?module=订单';
,
-- ++++++++++++++++++++ 财务模块 ++++++++++++++++++++

-- ----------------------------
-- 充值管理
-- ----------------------------
DROP TABLE IF EXISTS es_financial_recharge;
CREATE TABLE IF NOT EXISTS es_financial_recharge (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  serial_no VARCHAR(16) NOT NULL COMMENT '流水号',
  money DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '充值金额',
  user_remark VARCHAR(100) NOT NULL DEFAULT '' COMMENT '会员备注',
  admin_remark VARCHAR(100) NOT NULL DEFAULT '' COMMENT '管理员备注',
  payment_type VARCHAR(16) NOT NULL DEFAULT '' COMMENT '支付方式:cash=现金,bank=银行转账,alipay=支付宝,wxpay=微信',
  trade_no VARCHAR(32) NOT NULL DEFAULT '' COMMENT '第三方交易单号',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=已支付,2=未支付,3=已过期,4=已取消',
  created_at INT UNSIGNED NOT NULL COMMENT '充值时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '付款时间',
  mch_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
  PRIMARY KEY (id),
  KEY k_member_id (member_id),
  KEY k_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='充值管理?module=财务';

-- ----------------------------
-- 提现管理
-- ----------------------------
DROP TABLE IF EXISTS es_financial_withdrawal;
CREATE TABLE IF NOT EXISTS es_financial_withdrawal (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  serial_no VARCHAR(16) NOT NULL COMMENT '流水号',
  realname VARCHAR(60) NOT NULL DEFAULT '' COMMENT '姓名',
  payment_type VARCHAR(16) NOT NULL DEFAULT '' COMMENT '支付方式:bank=银行卡,alipay=支付宝,weixin=微信',
  trade_no VARCHAR(32) NOT NULL DEFAULT '' COMMENT '第三方交易单号',
  bank_name VARCHAR(60) NOT NULL COMMENT '银行名称',
  bank_no VARCHAR(32) NOT NULL DEFAULT '' COMMENT '银行卡号',
  bank_holder VARCHAR(10) NOT NULL DEFAULT '' COMMENT '开户人姓名',
  alipay_no VARCHAR(32) NOT NULL DEFAULT '' COMMENT '支付宝账号',
  wechat_no VARCHAR(15) NOT NULL DEFAULT '' COMMENT '微信号',
  money DECIMAL(10,2) UNSIGNED NULL DEFAULT 0.00 COMMENT '提现金额',
  commission_money DECIMAL(6,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '手续费',
  user_remark VARCHAR(150) NOT NULL DEFAULT '' COMMENT '会员备注',
  admin_remark VARCHAR(150) NOT NULL DEFAULT '' COMMENT '管理员备注',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  updated_at INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '审核时间',
  status TINYINT UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态:1=已提现,2=审核中,3=未通过',
  mch_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
  PRIMARY KEY (id),
  KEY k_member_id (member_id),
  KEY k_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='提现管理?module=财务';

-- ----------------------------
-- 财务日志管理
-- ----------------------------
DROP TABLE IF EXISTS es_financial_log;
CREATE TABLE IF NOT EXISTS es_financial_log (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  memo VARCHAR(255) NOT NULL DEFAULT '' COMMENT '变更原因',
  member_id INT UNSIGNED NOT NULL COMMENT '会员ID',
  member_type TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '会员类型:1=会员,2=经销商',
  currency_type TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '货币类型:1=人民币,2=虚拟币',
  money DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '变更金额',
  item_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '项目ID',
  item_type VARCHAR(64) NOT NULL DEFAULT '' COMMENT '项目类型',
  item_title VARCHAR(64) NOT NULL DEFAULT '' COMMENT '项目名称',
  item_event VARCHAR(64) NOT NULL DEFAULT '' COMMENT '交易事件',
  param JSON COMMENT '参数信息',
  ip VARCHAR(46) NOT NULL DEFAULT '' COMMENT 'IP',
  status TINYINT UNSIGNED NOT NULL COMMENT '资金流向:1=充值成功,2=提现申请,3=提现成功,4=提现撤回,11=商城下单,12=商城退货,13=取消订单,21=分销订单抽成,22=分销订单退款,61=兑换礼包,62=转账扣款,63=转账收款',
  created_at INT UNSIGNED NOT NULL COMMENT '创建时间',
  mch_id INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
  PRIMARY KEY (id),
  KEY k_member_id (member_id),
  KEY k_status (status),
  KEY k_currency_type (currency_type)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='财务日志管理?module=财务';
`
}

export default getExampleSql;